var mutations = {
  setUserInfo(state, userInfo) {
    state.userInfo = userInfo;
  },
  CHANGEt_RAIN_GO_TIME(state, travelTime) {
    state.train.travelTime = travelTime;
  },
  /*每次搜索清空火车出发车站名称*/
  CLEAR_TRAIN_GO_CITY_NAME(state, goCityName) {
    state.train.tabInfo[1].tabInfos = goCityName;
  },
  /*每次搜索清空火车到达车站名称*/
  CLEAR_TRAIN_BACK_CITY_NAME(state, goBackName) {
    state.train.tabInfo[2].tabInfos = goBackName;
  },
  /*booking 填单页的mutation*/
  /*获取上次订单乘机人*/
  setRecentPassengerList(state, recentPassengerList){
    var result;
    var type;
    if(recentPassengerList.type){
      result = state.passengers.concat(recentPassengerList.list);
      type  = recentPassengerList.type
    }else{
      result = state.passengers.concat(recentPassengerList);
    }

    /*连接两个数组之后去重*/
    //state.passengers = result;
    state.passengers = result.jsonRepeat('credentialNo',type).jsonRepeat('name',type);
  },
  ADD_PASSENGER(state, newPassenger){
    state.passengers.push(newPassenger)
  },
  DELETE_PASSENGER(state, passenger){
    state.passengers.splice(passenger,1);
  },
};
export default mutations;
